package algorithm.sort.n2;

/**
 * @author: Oliver
 * @time: 2020/5/31/11:04
 */
public class HelperTest {
    private HelperTest() {
    }

    // 生成有n个元素的随机数组,每个元素的随机范围为[rangeL, rangeR]
    public static Integer[] generateRandomArray(int n, int rangeL, int rangeR) {
        // assertion(断言) 在软件开发中是一种常用的调试方式
        assert rangeL <= rangeR;
        Integer[] ints = new Integer[n];
        for (int i = 0; i < n; i++) {
            ints[i] = new Integer((int) (Math.random() * (rangeR - rangeL + 1) + rangeL));//偏移量的设置
        }
        return ints;
    }

    // 打印arr数组的所有内容
    public static void printArray(Object arr[]) {

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
            System.out.print(' ');
        }
        System.out.println();

        return;
    }
}
